package com.lh.prototype.deepclone;

public class Client {

	public static void main(String[] args) throws Exception {
		DeepProtoType p = new DeepProtoType();
		p.name = "曹操";
		p.deepCloneableTarget = new DeepCloneableTarget("曹仁", "曹洪");

		// 方式1 完成深拷贝
		DeepProtoType p2 = (DeepProtoType) p.clone();
		System.out.println("p.name=" + p.name + "\tp.deepCloneableTarget=" + p.deepCloneableTarget.hashCode());
		System.out.println("p2.name=" + p.name + "\tp2.deepCloneableTarget=" + p2.deepCloneableTarget.hashCode());

		System.out.println("--------------------------------");

		// 方式2 完成深拷贝
		DeepProtoType p3 = (DeepProtoType) p.clone();
		System.out.println("p.name=" + p.name + "\tp.deepCloneableTarget=" + p.deepCloneableTarget.hashCode());
		System.out.println("p3.name=" + p.name + "\tp2.deepCloneableTarget=" + p3.deepCloneableTarget.hashCode());

	}
}
